Contents | Index | < Browse | Browse >

LETTERstrcmpULETTER Compares two strings.

Overview
#include <string.h>

int strcmp (const char *s1, const char *s2)

int r;
const char *s1;
const char *s2;

Portability
ANSI

Description
Compares the two strings "s1" and "s2" char-by-char. If both strings are exactly equal, the function returns zero. If the first different character in "s1" is smaller than the corrospending character in "s2", the value returned is smaller than 0, otherwise greater than 0. The zero byte at the end of a string is counted as the smallest char.

Returns
Zero if the strings are equal, <0 if the first string is "smaller" than the second, otherwise >0.

See also
strncmp , stricmp